<@master template="master/master-loan"  title="怡亚通380金服__修改密码">
<div class="registerBar">
	<div class="mainbox">
    	<div class="registerBox">
        	<div class=""><span class="fs24">密码设置</span></div>
            <div class="inpLi">
            	<ul>
                    <input name="mobile" type="hidden" class="dlInp" value="${member.mobile}">
                    <li class="mt15">
                    	<div class="inpTit fl">原始密码</div>
                    	<input name="oldPassword" type="password" class="dlInp" placeholder="请填写原始密码">
                    </li>
                    <li class="mt15">
                    	<div class="inpTit fl">新登录密码</div>
                    	<input name="newPassword" type="password" class="dlInp" placeholder="请填写6-16位密码">
                    </li>
                   	<li class="mt15">
                    	<div class="inpTit fl">确认新密码</div>
                    	<input name="firmPassword" type="password" class="dlInp" placeholder="请填写6-16位密码">
                    </li>
                    <li class="mt15">
                    	<img src="/common/getCaptcha" id="Img" style="width:90px; height:34px;" class='fr yzmImg yamIco' style=" width:1.3rem;">
                    	<div class="inpTit fl">图形验证码</div>
                    	<input name="erifyCode" type="text" style="width:130px" class="dlInp" placeholder="请输入图形验证码">
                    </li>
                </ul>
                <a id="submitBtn" href="#" class="ldBtn mt20">确定</a>
            </div>
        </div>
    </div>
	</div>
	<@include file="/common/footer"/>	
	<@js>  
	  $(document).ready(function(){
		  $("#Img").bind("click",function(){
		  	 var img = document.getElementById("Img");  
	         img.src = "/common/getCaptcha?rnd=" + Math.random();  
		  });
		  $("#submitBtn").bind("click",function(){
				var _this = $(this);
	    		var mobile = $("input[name='mobile']").val();
	    		
	    		var oldPassword = $("input[name='oldPassword']").val();	    		
	    		if (oldPassword == null || oldPassword == "") {
	    			$.actionDialog({message : "请填写原始密码"});
	    			return false;
	    		} else {
	    			var oldPasswordCheck = $.fn.validate.password(oldPassword);
		    		if(!oldPasswordCheck.isSuccess){
		    			$.actionDialog({message : "原始密码格式不正确"});
		    			return false;
		    		}
	    		}
	    		
	    		var newPassword = $("input[name='newPassword']").val();	    		
	    		if (newPassword == null || newPassword == "") {
	    			$.actionDialog({message : "请填写新登录密码"});
	    			return false;
	    		} else {
	    			var newPasswordCheck = $.fn.validate.password(newPassword);
		    		if(!newPasswordCheck.isSuccess){
		    			$.actionDialog({message : "新登录密码格式不正确"});
		    			return false;
		    		}
	    		}	    		
	    		
	    		var firmPassword = $("input[name='firmPassword']").val();	    		
	    		if (firmPassword == null || firmPassword == "") {
	    			$.actionDialog({message : "请再次填写新登录密码"});
	    			return false;
	    		}
	    		
	    		if (firmPassword != newPassword) {
	    			$.actionDialog({message : "两次输入密码不一致"});
		    		return false;
	    		}
	    		
	    		var erifyCode = $("input[name='erifyCode']").val();
	    		if(!erifyCode){
	    			$.actionDialog({message : '请输入图片验证码'});
	    			return false;
	    		}
	    		$.getJSON("/common/checkCaptcha",{captcha:erifyCode},function(result){
	    			if(result.data == true){
	   					$.ajax({
			    			url:"/uc/rest/alertPassword",
			    			dataType:"json",
			    			data:{mobile:mobile,oldPassword:oldPassword,newPassword:newPassword},
			    			success:function(msgResult){
			    				if(msgResult.data.success == true){
			    					window.location.href = "/uc/alertSuccess";
			    				}else{
			    					$.actionDialog({message : msgResult.data.errMsg});
			    				}
			    			}
			    		});
	   					
	   				}else{
	   					$.actionDialog({message : '图片验证码错误'});
	   				}
	    		});
			
			});
		})
	</@js>
	<@jsRender/>  
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
</@master>